package com.vcc.core.configurer;


import jakarta.validation.Validation;
import jakarta.validation.Validator;
import jakarta.validation.ValidatorFactory;
import org.hibernate.validator.HibernateValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ValidatorConfigurer {

    // This class can be used to configure any custom validators or validation settings
    // if needed in the future. Currently, it serves as a placeholder for potential
    // validation configurations.

    // Example: You could add a method to register custom validators here if required.

    @Bean
    public Validator validator()  {
        ValidatorFactory validatorFactory  = Validation.byProvider(HibernateValidator.class)
            .configure()
                .addProperty("hibernate.validator.fail_fast", "true")
                .buildValidatorFactory();
        return validatorFactory.getValidator();
    }

}
